package com.lixw.langchain.controller;

import dev.langchain4j.model.chat.ChatModel;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName: ModelParamterController
 * @Description:
 * @Author: xuweiLi
 * @Create: 2025/8/22 20:37
 **/
@Slf4j
@RestController
public class ModelParameterController {

    @Resource
    private ChatModel chatModel;

    @GetMapping("/modelParam/chat")
    public String getModelParameter(@RequestParam(value = "prompt",defaultValue = "你是谁") String prompt) {
        String chat = chatModel.chat(prompt);
        log.info("通义千问大模型plus 返回数据chat: {}", chat);
        return chat;
    }
}